<extend name="base/Base" />
<block name="Style">
<!-- FooTable Plugin CSS -->
		<link rel="stylesheet" type="text/css" href="__ABSOLUTEADMIN__/vendor/plugins/footable/css/footable.core.min.css">
		<!-- Admin Forms CSS -->
		<link rel="stylesheet" type="text/css" href="__ABSOLUTEADMIN__/assets/admin-tools/admin-forms/css/admin-forms.css">
		<js href="__ADDON__/ajaxupload/js/jquery.js" />
		<js href="__ADDON__/ajaxupload/js/ajaxupload.js" />
		<script type="text/javascript">
		$(function(){
			var button = $('#upload_button'), interval;
			var confirmdiv = $('#uploadphotoconfirm');
			var fileType = "pic",fileNum = "one"; 
			new AjaxUpload(button,{
				action: "__APP__/Home/Upload/Image/Addon/AjaxUpload.html",
				name: 'userfile',
				onSubmit : function(file, ext){
					if(fileType == "pic")
					{
						if (ext && /^(jpg|png|jpeg|gif|JPG)$/.test(ext)){
							this.setData({
								'info': '文件类型为图片'
							});
						} else {
							 confirmdiv.text('文件格式错误，请上传格式为.png .jpg .jpeg 的图片');
							return false;               
						}
					}
								
					confirmdiv.text('文件上传中');
					
					if(fileNum == 'one')
						this.disable();
					
					interval = window.setInterval(function(){
						var text = confirmdiv.text();
						if (text.length < 14){
							confirmdiv.text(text + '.');                    
						} else {
							confirmdiv.text('文件上传中');             
						}
					}, 200);
				},
				onComplete: function(file, response){
					if(response != "success"){
						if(response =='2'){
							confirmdiv.text("文件格式错误，请上传格式为.png .jpg .jpeg 的图片");
						}else{
							
							confirmdiv.text("上传完成");
							
							$("#newbikephotoName").val(response);
							$("#newbikephoto").attr("src",response);	
							$("#imgurl").attr("value",response);						
							
						}
						
					}
										  
					window.clearInterval(interval);
								
					this.enable();
					
					if(response == "success")
					alert('上传成功');              
				}
			});
		});
		</script>

</block>
<block name="Topbar">
 <header id="topbar" class="ph10">
        <div class="topbar-left">
          <ul class="nav nav-list nav-list-topbar pull-left">
            
            <li   >
              <a  href="__APP__/Admin/Data/Manage.html"   >数据管理</a>
            </li>
			<li   class="active">
              <a  href="__APP__/Admin/Data/Log.html"   >备份记录</a>
            </li>
           <li   >
              <a  href="__APP__/Home/Auth/Login/Addon/PHPMyAdmin.html" target="_blank"  >phpMyAdmin</a>
            </li>
          </ul>
        </div>
        <div class="topbar-right hidden-xs hidden-sm">
		<!--  <a href="#"  onclick="selectAll()" class="btn btn-default btn-sm fw600 ml10">
            <span class="fa fa-star pr5"></span>全选</a>
			 <a href="#"   onclick="unSelect()"  class="btn btn-default btn-sm fw600 ml10">
            <span class="fa fa-star-o pr5"></span>不选</a>
			 <a href="#"    onclick="reverse()"class="btn btn-default btn-sm fw600 ml10">
            <span class="fa fa-star-half-o pr5"></span>反选</a>
			   -->
			
			
			  <a href="#" onclick="backup(0)" class="btn btn-default btn-sm fw600 ml10">
				<span class="fa fa-star pr5"></span>备份</a>
				
			 <a href="#" onclick="optimize()" class="btn btn-default btn-sm fw600 ml10">
				<span class="fa fa-star-o pr5"></span>优化</a>
				
			 <a href="#" onclick="repair()" class="btn btn-default btn-sm fw600 ml10">
				<span class="fa fa-star-half-o pr5"></span>修复</a> 
			 
				<script>
						
						//新增数据
							function restore(file){  
							
							layer.confirm('你确定要这样做么？', {
						  btn: ['确定','取消'] //按钮
						}, function(){
						  
							$.ajax({
									type:'POST',
									url:"__APP__/Admin/Data/Restore.html",
									data:{
										
										"file": file,
										
										
										
										
									},
									success:function(data){			
										var info = eval(data)
										
										alert(data);
										if (info.errcode == 0) {
										
											layer.msg(info.errmsg);
											setTimeout(window.location.reload(),3000);
											
										}else{
											layer.msg(info.errmsg);
										}
									},
									error:function(){
										layer.msg('系统繁忙,请稍候重试！');
									}
								
								});	  
						  
						}, function(){
						  
						  
						});
							
								
							} 
							
							//新增数据
							function backup(){  
							
							
							
								$.ajax({
									type:'POST',
									url:"__APP__/Admin/Data/Backup.html",
									data:{
										
										"status": 1,
										
										
										
										
									},
									success:function(data){			
										var info = eval(data)
										if (info.errcode == 0) {
										
											layer.msg(info.errmsg);
											setTimeout(window.location.reload(),3000);
											
										}else{
											layer.msg(info.errmsg);
										}
									},
									error:function(){
										layer.msg('系统繁忙,请稍候重试！');
									}
								
								});	 
							} 
//新增数据
							function optimize(){  
							
							
							
								$.ajax({
									type:'POST',
									url:"__APP__/Admin/Data/Optimize.html",
									data:{
										
										"status": 1,
										
										
										
										
									},
									success:function(data){			
										var info = eval(data)
										if (info.errcode == 0) {
										
											layer.msg(info.errmsg);
											setTimeout(window.location.reload(),3000);
											
										}else{
											layer.msg(info.errmsg);
										}
									},
									error:function(){
										layer.msg('系统繁忙,请稍候重试！');
									}
								
								});	 
							}  

								function repair(){  
							
							
							
								$.ajax({
									type:'POST',
									url:"__APP__/Admin/Data/Repair.html",
									data:{
										
										"status": 1,
										
										
										
										
									},
									success:function(data){			
										var info = eval(data)
										if (info.errcode == 0) {
										
											layer.msg(info.errmsg);
											setTimeout(window.location.reload(),3000);
											
										}else{
											layer.msg(info.errmsg);
										}
									},
									error:function(){
										layer.msg('系统繁忙,请稍候重试！');
									}
								
								});	 
							}  							
					</script>							
          
        </div>
      </header>
      
</block>
<block name="Content">
	 <!-- begin: .tray-center -->
        <div class="row">

        <!-- Panel with: Data Filter -->
          <div class="col-md-12" id="spy2" >
            <div class="panel-heading">
              <span class="panel-title">
                <span class="fa fa-search"></span>数据信息</span>
               <div class="pull-right">
			 				
            <!--    <a  href="#" data-toggle="modal" data-target="#myModal" class="btn btn btn-primary">新增数据</a>						
								
							 -->	<!-- Modal -->
									<div class="modal fade" id="myModal" tabindex="-1" role="dialog" aria-labelledby="myModalLabel">
									  <div class="modal-dialog" role="document">
										<div class="modal-content">
										  <div class="modal-header">
											<button type="button" class="close" data-dismiss="modal" aria-label="Close"><span aria-hidden="true">&times;</span></button>
											<h4 class="modal-title" id="myModalLabel">新增数据</h4>
										  </div>
										  <div class="modal-body">
										    <form class="form-horizontal" role="form">
					
				<div class="form-group">
                    <label for="inputStandard" class="col-lg-3 control-label" style="padding-top:0px;">数据名称</label>
                    <div class="col-lg-8"  style="padding-top:2px;">
                      <div class="">
                        <input type="text" name="name" id="name" class="form-control input-lg" placeholder="请输入数据名称">
                      </div>
                    </div>
                  </div>
				 
				  
                
				
                  <div class="form-group">
                    <label for="inputStandard" class="col-lg-3 control-label" style="padding-top:0px;">数据标示</label>
                    <div class="col-lg-8"  style="padding-top:2px;">
                      <div class="">
                        <input type="text" name="sole" id="sole" class="form-control input-lg" placeholder="请输入数据标示">
                      </div>
                    </div>
                  </div>
				  
				  <div class="form-group">
                    <label for="inputStandard" class="col-lg-3 control-label" style="padding-top:0px;">数据说明</label>
                    <div class="col-lg-8"  style="padding-top:2px;">
                      <div class="">
                        <input type="text" name="intro" id="intro" class="form-control input-lg" placeholder="请输入数据说明">
                      </div>
                    </div>
                  </div>
				 
				 
				
				
				  
				  
				
				
                </form>
              			
						
										  </div>
										  <div class="modal-footer">
											<button type="button" class="btn btn-default" data-dismiss="modal">关闭页面</button>
											<a href="#" class="btn btn-primary" onclick="create()" >新增数据</a>
											
										  </div>
										</div>
									  </div>
									</div>
								<script>
						
							//新增数据
							function create(){  
							
								var name = $("#name").val();
								var intro = $("#intro").val();
								
								var sole = $("#sole").val();
							
								$.ajax({
									type:'POST',
									url:"__APP__/Admin/Behavior/Create.html",
									data:{
										
										"fbid": {$fbid},
										"tier": {$tier},
										"name": name,
										
										"intro": intro,
										"sole": sole,
										
										
										
									},
									success:function(data){			
										var info = eval(data)
										if (info.errcode == 0) {
										
											layer.msg(info.errmsg);
											setTimeout(window.location.reload(),3000);
											
										}else{
											layer.msg(info.errmsg);
										}
									},
									error:function(){
										layer.msg('系统繁忙,请稍候重试！');
									}
								
								});	 
							}  
							
							function AJAXDelete(id){  
								if(confirm('是否确认删除')){
									$.ajax({
										type:'POST',
										url:"__APP__/AICMF/Menu/Value/Delete.html",
										data:{
											"id": id,
											
										},
										success:function(data){								
											if (data == 1) {
											alert('删除成功');
											window.location.reload();
											}else{
												alert(data);
											}
										},
										error:function(){
											alert('未知错误');
										}
									
									});	 
								}
							} 
							
							function AJAXOutage(id){  
								if(confirm('是否确认隐藏')){
									$.ajax({
										type:'POST',
										url:"__APP__/AICMF/Menu/Value/Outage.html",
										data:{
											"id": id,
											
										},
										success:function(data){								
											if (data == 1) {
											alert('隐藏成功');
											window.location.reload();
											}else{
												alert(data);
											}
										},
										error:function(){
											alert('未知错误');
										}
									
									});	 
								}
							} 
							
							function AJAXEnabled(id){  
								if(confirm('是否确认显示')){
									$.ajax({
										type:'POST',
										url:"__APP__/AICMF/Menu/Value/Enabled.html",
										data:{
											"id": id,
											
										},
										success:function(data){								
											if (data == 1) {
											alert('显示成功');
											window.location.reload();
											}else{
												alert(data);
											}
										},
										error:function(){
											alert('未知错误');
										}
									
									});	 
								}
							} 
							</script>
							
              </div> 
            </div>
            <div class="panel-menu">
              <input id="fooFilter" type="text" class="form-control" placeholder="请输入搜索的关键字">
            </div>
            <div class="panel-body pn">
              <table class="table footable" data-filter="#fooFilter"  data-page-navigation=".pagination" data-page-size="100">
               <thead>
												<tr>
													
													<!-- <th style="width:4%;">批量</th>
													 --><th data-hide="phone,tablet">#</th>
													<th data-class="expand">文件名</th>
													
												
													
													
													<th data-hide="phone">文件大小</th>
													<th data-hide="phone">备份时间</th>
													<th data-hide="phone">操作</th>
													
													
												</tr>
											</thead>
											<tbody>
												<volist name="list" id="list">
												<tr>
													<!-- <td class="text-center">
													<center>
														<label class="option block mn">
														  <input type="checkbox" id="batch" name="batch" value="{$list.id}">
														
														</label>
														</center>
													  </td> -->
													<td>{$i}</td>
													<td>{$list.name}
														</td>
														
														
														<td>
														<if condition="$list.size eq 0"> 
														未占硬盘
													
														<else /> 
														{$list.size}
														</if>
														
														</td>
														
														<td>{$list.time|date="Y-m-d H:i:s",###}</td>
														
														<td>
														
														
						
																<a  href="__APP__/Admin/Data/Download/file/{$list.name}.html"  class="btn btn-xs btn-success">下载</a>
																<!-- <a  href="#" onclick="restore('{$list.name}');"  class="btn btn-xs btn-danger">还原</a>
														 -->
														</td>
					
													
												
													
														
														
													</td>
												</tr>
												</volist>
											</tbody>
											 <tfoot class="footer-menu">
												<tr>
												  <td colspan="12">
													<nav class="text-right">
													  <ul class="pagination hide-if-no-paging"></ul>
													</nav>
												  </td>
												</tr>
											  </tfoot>

										</table>
            </div>
          </div>
		      
      </div>

		
</block>
<block name="Script">
	
  <!-- FooTable Plugin -->
  <script src="__ABSOLUTEADMIN__/vendor/plugins/footable/js/footable.all.min.js"></script>
   <!-- FooTable Addon -->
  <script src="__ABSOLUTEADMIN__/vendor/plugins/footable/js/footable.filter.min.js"></script>
  
 <script type="text/javascript">
 
	
		function unSelect(){
				
		  $("input[id='batch']").each(function(){
		   $(this).prop("checked",false);
		  });  
		  
	
		}
		
		function selectAll(){
				
		 $("input[id='batch']").each(function(){
		   $(this).prop("checked",true);
		  });  
		  
		}
		
		function reverse(){
				
		 $("input[id='batch']").each(function(){
			$(this).prop("checked",!this.checked);   
		  
			})
		}
		
		function status(status){
				
				
						 var id=$('input[id="batch"]:checked').map(function(){return this.value}).get().join();
						
						layer.confirm('你确定要这样做么？', {
						  btn: ['确定','取消'] //按钮
						}, function(){
						  
						  $.ajax({
								type:'POST',
								url:"__APP__/Admin/Behavior/Delete.html",
								data:{
									
									"id": id,
									"status": status,
									
								},
								success:function(data){			
										var info = eval(data)
										if (info.errcode == 0) {
										
											layer.msg(info.errmsg);
											setTimeout(window.location.reload(),3000);
											
										}else{
											layer.msg(info.errmsg);
										}
								},
								error:function(){
									layer.msg('系统繁忙,请稍候重试！');
								}
							
							});	 
						  
						}, function(){
						  
						  
						});

					
				
				}
				
		  </script>
 <script type="text/javascript">
  jQuery(document).ready(function() {

 

    // Init FooTable Examples
    $('.footable').footable();


  });
  </script>
</block>